/*
 *
 *  * Copyright (c) 2016. For Intelligent Group.
 *
 */

package com.intelligent.ispc.utils;

import javax.swing.*;
import java.awt.*;

/**
 * Created by Peter on 2015/12/9.
 */
public enum RuleLevelType {
    NORMAL("NORMAL"),
    EXCELLENT("EXCELLENT"),
    GOOD("GOOD"),
    ACCEPTABLE("ACCEPTABLE"),
    ABOVE_RECTIFICATION("ABOVE_RECTIFICATION"),
    RECTIFICATION("RECTIFICATION");

    private String code;

    RuleLevelType(String code) {
        this.code = code;
    }

    public String getCode() {
        return this.code;
    }

    /**
     * Get RuleLevelType enum value by given code.
     *
     * @param code code.
     * @return RuleLevelType
     */
    public RuleLevelType getByCode(String code) {
        switch (code) {
            case "NORMAL":
                return RuleLevelType.NORMAL;
            case "EXCELLENT":
                return RuleLevelType.EXCELLENT;
            case "GOOD":
                return RuleLevelType.GOOD;
            case "ACCEPTABLE":
                return RuleLevelType.ACCEPTABLE;
            case "ABOVE_RECTIFICATION":
                return RuleLevelType.ABOVE_RECTIFICATION;
            case "RECTIFICATION":
                return RuleLevelType.RECTIFICATION;
            default:
                return RuleLevelType.NORMAL;
        }
    }

}


